<script type="text/javascript">
    //调用微信JS api 支付
    function jsApiCall()
    {
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest',{$json},
            function(res){
//                WeixinJSBridge.log(res.err_msg);
                if(res.err_msg == 'get_brand_wcpay_request:ok'){
                    location.reload();
//                    alert('支付成功');
//                    去我的预约里的预约成功的页面（第一次带弹窗出信息）;
                }else{
                    alert('支付失败');
//                    $('.all_div').css('display','none');
                    location.reload();
                }
            }
        );
    }
    function callpay()
    {
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        }else{
            jsApiCall();
        }
    }
    callpay();
</script>